import { createRouter, createWebHistory } from 'vue-router'
import routes from './routers'

import {get_token} from '@/utils/auth';


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})


router.beforeEach((to, from,next) => {
  // ...
  // 返回 false 以取消导航
  if(!to.meta.not_check){
    if(!get_token()){
      next('/login');
      return;
    }
  }
  next();
  
})

export default router
